package com.ruoyi.product.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.product.domain.StoreProduct;
import com.ruoyi.product.domain.StoreProductJoint;
import com.ruoyi.product.mapper.StoreProductJointMapper;
import com.ruoyi.product.mapper.StoreProductMapper;
import com.ruoyi.product.service.IStoreProductJointService;
import com.ruoyi.product.service.IStoreProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 商品Service业务层处理
 *
 * @author ruoyi
 * @date 2021-11-22
 */
@Service
public class StoreProductServiceJointImpl implements IStoreProductJointService
{
    @Autowired
    private StoreProductJointMapper storeProductJointMapper;


    @Override
    public List<StoreProduct> selectStoreProductJointByParam(Map<String, Object> params)
    {
        return storeProductJointMapper.selectStoreProductJointByParam(params);
    }

    @Override
    public List<StoreProductJoint> selectStoreProductJointByParamTrue(Map<String, Object> params)
    {
        return storeProductJointMapper.selectStoreProductJointByParamTrue(params);
    }


    /**
     * 查询
     *
     * @param id 商品主键
     * @return 商品
     */
    @Override
    public StoreProductJoint selectStoreProductById(Long id)
    {
        return storeProductJointMapper.selectStoreProductById(id);
    }

    /**
     * 查询
     *
     * @param store_id 门店id , store_product_id 商品id
     * @return 商品
     */
    @Override
    public StoreProductJoint selectStoreProductByStoreIdAndStoreId(Long storeId,Long storeProductId)
    {
        return storeProductJointMapper.selectStoreProductByStoreIdAndStoreId(storeId,storeProductId);
    }


    /**
     * 新增商品
     *
     * @param
     * @return 结果
     */
    @Override
    public int insertStoreProductJoint(StoreProductJoint storeProductJoint)
    {
        storeProductJoint.setCreateTime(DateUtils.getNowDate());
        return storeProductJointMapper.insertStoreProductJoint(storeProductJoint);
    }

    /**
     * 修改
     *
     * @param
     * @return 结果
     */
    @Override
    public int updateStoreProductJoint(StoreProductJoint storeProductJoint)
    {
        storeProductJoint.setUpdateTime(DateUtils.getNowDate());
        return storeProductJointMapper.updateStoreProductJoint(storeProductJoint);
    }


}
